﻿@using Webdiyer.WebControls.Mvc
@model MvcWeb.ViewModels.Inventory.InventoryModel
@{
    ViewBag.Title = "资产盘点列表";
    var memberIDDict = (Dictionary<Guid, string>)ViewData["memberIDDict"];
}
@if (false)
{
    <script src="../../Scripts/jquery-1.5.1-vsdoc.js" type="text/javascript"></script>
}
<div style="padding: 5px 10px;">
    <a href="@Url.Action("edit", "Inventory", new { id = -1 })" class="btn_green">新建盘点</a>
</div>
<div style="padding: 0px 10px; margin-bottom: 5px;">
    <table id="searchbox" class="tb" width="98%" style="text-align: center;">
    @using (Html.BeginForm())
    {
        <tr>
            <td style="width: 80px;">@Html.LabelFor(m => m.conditionModel.AssetInventoryName)</td>
            <td>
                @Html.TextBoxFor(m => m.conditionModel.AssetInventoryName)
            </td>
            <td style="width: 80px;">@Html.LabelFor(m => m.conditionModel.InventoryState)</td>
            <td>
                @Html.DropDownListFor(m => m.conditionModel.InventoryState, new SelectList((Dictionary<int, string>)ViewData["inventoryStatus"], "key", "value"), "请选择类型")

            </td>
        </tr>
        
        <tr>
            <td style="width: 80px;">盘点起止时间</td>
            <td>
                @Html.TextBoxFor(m => m.conditionModel.InventoryStartTime)
            </td>
           
            <td colspan="2">
                @Html.TextBoxFor(m => m.conditionModel.InventoryEndTime)
            </td>
        </tr>
        
        <tr>
            <td style="width: 80px;">@Html.LabelFor(m => m.conditionModel.InventoryMember)</td>
            <td>
                @Html.DropDownListFor(m => m.conditionModel.InventoryMember, new SelectList( memberIDDict  , "key", "value"), "请选择类型")
            </td>
            <td style="width: 80px;">@Html.LabelFor(m => m.conditionModel.InventoryCheckMember)</td>
            <td>
                @Html.DropDownListFor(m => m.conditionModel.InventoryCheckMember, new SelectList( memberIDDict, "key", "value"), "请选择类型")

            </td>
        </tr>
        
        <tr>
            <td colspan="4">
                <input type="submit" id="search" class="btn_green" value="查询" />
            </td>
        </tr>
    }
    </table>
    <script type="text/javascript">
        function f_search() {
            var url = window.location.pathname + '?' + $("#searchbox :input, #searchbox select").serialize();
            window.location = url;
        }
    </script>
</div>
<div style="padding: 0px 10px;">
    <table class="tb" width="98%" style="text-align: center;">
        <tr>
             <th valign="top">编号</th><th>盘点名称</th><th>盘点人</th><th>开始时间</th><th>结束时间</th><th>审核人</th><th>盘点描述</th><th>操作</th>
        </tr>
        @foreach (var m in Model.inventoryModelList)
        {
            <tr>
                <td>@m.AssetInventoryID</td>
                <td>@m.AssetInventoryName</td>
                <td>@memberIDDict[(m.AssetInventoryMember ?? new Guid())] 
                </td>
                <td>@m.AssetInventoryStartDateTime</td>
                <td>@m.AssetInventoryEndDateTime</td>
                <td> @memberIDDict[(m.AssetInventoryCheckMember ?? new Guid())]</td>                
                <td>@m.AssetInventoryDescript</td>
                <td width="80">
                    <a href="@Url.Action("edit", "Inventory", new { id = m.AssetInventoryID })">编辑</a>
                    <a href="@Url.Action("InventoryDetail", "Inventory", new { id = m.AssetInventoryID })">详细</a>
                    <a href="@Url.Action("InventoryCategoryDetail", "Inventory", new { id = m.AssetInventoryID })">盘点汇总</a>
                    
                    @{
                        if ( (m.AssetInventoryCheckMember ?? new Guid()) == new Guid() )
                        {
                             <a href="@Url.Action("InventUploadIndex", "Inventory", new { id = m.AssetInventoryID })">添加盘点数据</a>
                        }    
                    }
 


                </td>
            </tr>
        }
        <tr>
             
            <td colspan="8" style="text-align: left;">
                <div style="float: left;">                     
                </div>
                <div style="float: right;">
                    @Html.Pager(Model.inventoryModelList)
                </div>
            </td>
        </tr>
    </table>
</div>


<script type="text/javascript">
    $(function () {
        $("#conditionModel_InventoryStartTime").ligerDateEditor({ initValue: $("#conditionModel_InventoryStartTime").val() });
        $("#conditionModel_InventoryEndTime").ligerDateEditor({ initValue: $("#conditionModel_InventoryEndTime").val() });
    });
</script>